// test_framework.h - Enhanced version with dynamic registration
#ifndef _TEST_FRAMEWORK_H
#define _TEST_FRAMEWORK_H

#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/module.h>

struct test_case {
    const char *name;
    int (*test_func)(struct seq_file *m);
};

struct test_suite {
    const char *name;
    struct test_case *test_cases;
    int num_tests;
};

extern int test_debug_level;

// Test result macros with debug level control
// Test result macros with function name
#define TEST_PASS(m, fmt, ...) seq_printf(m, "\033[32mPASS\033[0m: [%s] " fmt "\n", __func__, ##__VA_ARGS__)
#define TEST_FAIL(m, fmt, ...) seq_printf(m, "\033[31mFAIL\033[0m: [%s] " fmt "\n", __func__, ##__VA_ARGS__)
#define TEST_INFO(m, fmt, ...) seq_printf(m, "INFO: [%s] " fmt "\n", __func__, ##__VA_ARGS__)
#define TEST_END(m, fmt, ...) seq_printf(m, "\033[34mEND: [%s] ------" fmt "------\033[0m\n", __func__, ##__VA_ARGS__)


// Add the new debug macro
#define TEST_PASS_DEBUG(m, fmt, ...) do { \
    if (test_debug_level >= 3) \
        seq_printf(m, "DEBUG: [%s] " fmt "\n", __func__, ##__VA_ARGS__); \
} while(0)

// Function declarations for test registration
typedef struct test_module {
    struct test_case *test_cases;
    int num_tests;
    const char *module_name;
    struct list_head list;
} test_module_t;

// Framework functions
int register_test_suite(const char *name);
void unregister_test_suite(void);
int register_test_module(test_module_t *module);
void unregister_test_module(test_module_t *module);

#endif /* _TEST_FRAMEWORK_H */